package it.fc.action.giocatori;

import it.fc.action.FcAction;
import it.fc.bean.SquadraBean;
import it.fc.bean.UserBean;
import it.fc.service.interfaces.IDbService;

public class TeamAction extends FcAction {

    private static final long   serialVersionUID = 7585506151656974440L;
    private static final String RETURN_NEW       = "new";

    @Override
    public String execute() throws Exception {

        int idUser = ((UserBean) getSession().get("user")).getIdUser();
        IDbService dbMan = getDbService();
        SquadraBean team = dbMan.getSquadraByUser(idUser);

        if (team == null) { // l'utente non ha squadra
            return RETURN_NEW;
        }

        return SUCCESS;
    }

}
